"""p9_exe URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from .views import *
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
# 收货地址管理
router.register("address",AddrViewSet),
# 评价
router.register("common",CommonAPIView),
# 修改用户信息
router.register("up_uer",UpUserView),
urlpatterns = [
    # 发送短信验证码
    path('send_code/<str:mobile>', UserView.as_view({"get": "sms_code"})),
    # 用户注册
    path('register/', UserView.as_view({"post": "register_user"})),
    # 用户登录
    path('login/', UserView.as_view({"post":"login"})),
    # 获取用户信息 修改用户信息
    path('user/', UserView.as_view({"get":"user_dict","put":"up_user"})),
    #新建订单
    path("order/",Order_view.as_view({"post":"now_order"})),
    #查看用户订单
    path('orders/', Order_view.as_view({"get":"list"})),
    # 校验
    path('auth_check/', Order_view.as_view({"get":"auth_check"})),


]
urlpatterns += router.urls
